*###########################################################*
* Who is Perceived as Deserving?                            *
* Ross, Rouse, Alcañiz, and Marchevsky                      *
* Journal: PS: Political Science & Politics                 *
* Stata Replication Code                                    *
* Tested on Stata 18.0                                      *
*###########################################################*

clear all
clear matrix
set more off, perm
cd "\Users\ashleydross\Dropbox\Disasters and Deservedness Project\Disaster and Deservingness for PS\PS Submission Docs\PS R&R Docs" /*set your own working directory*/
use "dis_deserv.dta", replace 

*REGRESSION & MARGINAL EFFECTS (Table 1)
svyset [pweight=weight_national]
svy: mlogit v43assist i.v43maria i.republican i.bothparentus i.race3 disexp risk dis_resp assist_like female c.age ed income, b(0)  
margins, dydx (_all) post

*COVARIATE PROFILES (Table 2)
svyset [pweight=weight_national]
quietly svy: mlogit v43assist i.v43maria i.republican i.bothparentus i.race3 disexp risk dis_resp assist_like female c.age ed income, b(0)  
margins, at(race3=1 v43maria=1 republican=1 bothparentus=1 disexp=0 risk=0 dis_resp=1 assist_like=4 female=0 age=7.6 ed=4.2 income=8)
margins, at(race3=1 v43maria=0 republican=1 bothparentus=1 disexp=0 risk=0 dis_resp=1 assist_like=4 female=0 age=7.6 ed=4.2 income=8)
margins, at(race3=2 v43maria=1 republican=0 bothparentus=0 disexp=0 risk=1 dis_resp=1 assist_like=4 female=1 age=5.6 ed=3.6 income=6.9)
margins, at(race3=2 v43maria=0 republican=0 bothparentus=0 disexp=0 risk=1 dis_resp=1 assist_like=4 female=1 age=5.6 ed=3.6 income=6.9)
margins, at(race3=3 v43maria=1 republican=0 bothparentus=1 disexp=0 risk=1 dis_resp=1 assist_like=4 female=1 age=5.7 ed=4.2 income=7.6)
margins, at(race3=3 v43maria=0 republican=0 bothparentus=1 disexp=0 risk=1 dis_resp=1 assist_like=4 female=1 age=5.7 ed=4.2 income=7.6)

*APPENDIX B (Table B) - Descriptive statistics
svyset [pweight=weight_national]
svy: mlogit v43assist i.v43maria i.republican i.bothparentus i.race3 disexp risk dis_resp assist_like female c.age ed income, b(0)  
sum v43assist v43maria republican bothparentus race3 disexp risk dis_resp assist_like female age ed income if e(sample)

*APPENDIX C (Tables C1, C2, and C3) - Vignette assignments with Latino names ("v_lat" - Maria & Harvey; "v_latM" - Maria only; "v_latH" - Harvey only)
svyset [pweight=weight_national]
svy: mlogit v43assist i.v_latm i.republican i.bothparentus i.race3 disexp risk dis_resp assist_like female age ed income, b(0)  
svy: mlogit v43assist i.v_lath i.republican i.bothparentus i.race3 disexp risk dis_resp assist_like female age ed income, b(0)  
svy: mlogit v43assist i.v_lat i.republican i.bothparentus i.race3 disexp risk dis_resp assist_like female age ed income, b(0)  

*APPENDIX D (Table D1) - Tabulations of Independent Variables for Covariate profiles
svyset [pweight=weight_national]
svy: tab republican race3, column
svy: tab bothparentus race3, column
svy: tab disexp race3, column
svy: tab risk race3, column
svy: tab dis_resp race3, column
svy: tab assist_like race3, column
svy: tab female race3, column
svy: mean age if race3==1
svy: mean age if race3==2
svy: mean age if race3==3
svy: mean age
svy: mean ed if race3==1
svy: mean ed if race3==2
svy: mean ed if race3==3
svy: mean ed
svy: mean income if race3==1
svy: mean income if race3==2
svy: mean income if race3==3
svy: mean income